package com.lvan.rabbitboot.helloworld;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


/**
 * queuesToDeclare：没有队列会自动声明一个队列
 * durable: 是否持久化
 * autoDelete: 是否自动删除
 * @author Lvan
 */
@Component
@RabbitListener(queuesToDeclare = @Queue(value = "hello", durable = "false", autoDelete = "true"))
public class Consumer {

    @RabbitHandler
    public void receiveHello(String message) {
        System.out.println("hello queue: " + message);
    }

}
